package org.kazuhiko.rpg.server.task.tasks;

import org.apache.mina.core.session.IoSession;
import org.kazuhiko.rpg.server.net.RPGSession;
import org.kazuhiko.rpg.server.net.packet.Packet;
import org.kazuhiko.rpg.server.task.Task;

public final class SessionMessageTask implements Task
{
	private final IoSession session;
	
	private final Packet packet;
	
	public SessionMessageTask( IoSession session, Packet packet )
	{
		this.session = session;
		this.packet = packet;
	}
	
	@Override
	public void execute()
	{
		assert( session.getAttribute( "attachment" ) != null );
		( ( RPGSession ) session.getAttribute( "attachment" ) ).handle( packet );
	}
}
